package com.jrx.anytxn.reporting.job.xib.step;

import com.jrx.anytxn.reporting.entity.CmInteCoImpairmentInfo;
import com.jrx.anytxn.reporting.mapper.base.CmInteCoImpairmentInfoMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ImpairmentWriter implements ItemWriter<CmInteCoImpairmentInfo> {

    @Resource
    private CmInteCoImpairmentInfoMapper cmInteCoImpairmentInfoMapper;

    @Override
    public void write(List<? extends CmInteCoImpairmentInfo> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)){
            for(CmInteCoImpairmentInfo impairmentInfo : items){
                cmInteCoImpairmentInfoMapper.insertSelective(impairmentInfo);
            }
        }
    }
}
